#include <iostream>
#include <stdio.h>
#include <string>
#include <sys/types.h>
#include <signal.h>

using std::cout;
using std::endl;

int main(int argc, char *argv[])
{
    if(argc != 3)
    {
        cout << "./mykill signumber pid" << endl;
        return 1;
    }
    // int kill(pid_t pid, int sig); 成功返回0，失败返回-1
    int sig = std::stoi(argv[1]);
    pid_t pid = std::stoi(argv[2]);

    int n = kill(pid, sig);
    if(n == 0)
    {
        printf("发送信号%d给进程%d\n", sig, pid);
    } 

    return 0;
}